<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="geometry" content="diagram">
  <link rel="stylesheet" href="./assets/common.css">
  <title>city demo</title>
  <style>
    #map {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 100%;
    }

    #timepannel {
      background: white;
      z-index: 10;
      position: absolute;
      right: 50px;
      padding: 10px;
    }
  </style>
</head>

<body>
  <div id='timepannel'>时间: 6时</div>
  <div id="map">

  </div>
  <script src="https://webapi.amap.com/maps?v=1.4.8&key=f28fca5384129d180ad82915156a9baf&plugin=Map3D"></script>
  <script src="./assets/jquery-3.2.1.min.js"></script>
  <script src="../build/L7.js"></script>
  <script>
    var buildLayer = null;
    const scene = new L7.Scene({
      id: 'map',
      mapStyle: 'amap://styles/c9f1d10cae34f8ab05e425462c5a58d7', // 样式URL
      center: [120.102915, 30.261396],
      pitch: 0,
      zoom: 12,
      minZoom: 5,
      maxZoom: 18
    });
    scene.on('loaded', () => {
      scene.image.addImage('arrow', '/demos/assets/arrow.png');
      scene.image.addImage('right', '/demos/assets/right.png');
      scene.image.addImage('plane','https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*LzsbQZeK_2kAAAAAAAAAAABkARQnAQ')

      const mapData = {
        "type": "FeatureCollection",
        "features": [{
          "type": "Feature",
          "properties": { "type": 'right' },
          "geometry": {
            "type": "LineString",
            "coordinates": [
              [120.294931, 30.224459],[120.294931, 30.224459],
              [120.194847, 30.224384],[120.194847, 30.224384],[120.194847, 30.224384],
              [120.294847, 30.274384],
              [120.344847, 30.34384],
              [120.364847, 30.374384],
              [120.364847, 30.074384],[120.364847, 30.074384],[120.364847, 30.074384],
            ]
          }
        }, {
          "type": "Feature",
          "properties": { "type": 'plane' },
          "geometry": {
            "type": "LineString",
            "coordinates": [
              [120.394931, 30.324459],
              [120.494847, 30.324384],
              [120.494847, 30.324384],[120.494847, 30.324384],
              [120.45, 30.324384],
              [120.45, 30.374384],
            ]
          }
        }]
      };

      const linelayer = scene.LineLayer({
        zIndex: 2
      }).shape('line')
        .size([10, 0])
        .source(mapData)
        .color('#fff')
        .active(true)
        .pattern('type', function (type) {
          return type;
        })
        .style({
          patternSpacing: 20
        })
        .render();
      $.get('https://gw.alipayobjects.com/os/basement_prod/3ed18d7c-bce4-48ca-8716-5248b584481d.json', data => {
        const linelayer = scene.LineLayer({
          zIndex: 2
        }).shape('line')
          .size([10, 0])
          .source(data)
          .color('#fff')
          .pattern('right')
          .style({
            patternSpacing: 20
          })
          .render();
      })
    })
  </script>
</body>

</html>